#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    vector<int> res;
    void dfs(map<int, int>& hash, int con, int level)
    {
        if (level == 3)
        {
            res.push_back(con);
            return;
        }
        for (auto& [a, b] : hash)
        {
            if (b > 0 && ((level == 0 && a != 0) || level == 1 || (level == 2 && a % 2 == 0)))
            {
                b--;
                dfs(hash, con * 10 + a, level + 1);
                b++;
            }
        }
    }
    vector<int> findEvenNumbers(vector<int>& digits) {
        map<int, int> hash;
        for (auto& e : digits) hash[e]++;
        dfs(hash, 0, 0);
        return res;
    }
};